<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue基础模板</title>
    <script src="../vue.js"></script>
    <style>
        .login{
            background-color: skyblue;
        }
        .register{
            background-color: rgb(182, 255, 148);
        }
    </style>
</head>

<body>
    <div id="app">
        <button @click="isLogin=true">登陆</button>
        <button @click="isLogin=false">注册</button>
        <h1>{{isLogin?'登陆界面':'注册界面'}}</h1>
        <form v-if="isLogin===true" class="login" key="login">
            请输入用户名<input type="text" name="usename"><br>
            请输入密码<input type="password" name="password">
        </form>
        <form v-else class="register" key="register">
            请输入用户名<input type="text" name="usename"><br>
            请输入密码<input type="password" name="password">
        </form>
    </div>

    <script>
        Vue.config.productionTip = false;
        const vm = new Vue({
            el: "#app",
            data() {
                return {
                    isLogin:true
                }
            }
        })
    </script>
</body>

</html>